Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve selection and merged cell announcements in LibreOffice Calc 7.3 and above #12849

Merged
merged 11 commits into from Oct 20, 2021

Conversation

LeonarddeR
Copy link
Collaborator

@LeonarddeR LeonarddeR commented Sep 15, 2021

Link to issue number:

Fixes #9310
Fixes #6897

Summary of the issue:

In LibreOffice calc, selection is not announced and for merged cells, only the first cell is announced.

Description of how this pull request fixes the issue:

In LibreOffice 7.3 development branch, support for IAccessibleTable2 and IAccessibleTableCell were added. This allows us to implement something that works as expected.
Daily builds that support this new functionality can be downloaded here

Testing strategy:

  1. Merged several cells and observed that the announcement was appropriate.
  2. Selected several cells and observed that the announcement was appropriate.

Known issues with pull request:

LibreOffice doesn't fire selectionRemove event properly. This is a known issue that's being investigated.

Change log entries:

Changes

Code Review Checklist:

  • Pull Request description is up to date.
  • Unit tests.
  • System (end to end) tests.
  • Manual testing.
  • API is compatible with existing addons.
  • User Documentation.
  • Change log entry.
  • Context sensitive help for GUI changes.
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers

@AppVeyorBot
Copy link

See test results for failed build of commit 1692477c49

@LeonarddeR
Copy link
Collaborator Author

Thanks to @michaelweghorn who's doing all the great stuff at the Libre side.

@LeonarddeR
Copy link
Collaborator Author

LeonarddeR commented Sep 23, 2021

I proposed a general way to announce selection in #6959. If people agree, I want to generalize the selection approach in with a follow up.

@LeonarddeR LeonarddeR marked this pull request as ready for review September 24, 2021 05:59
@LeonarddeR LeonarddeR requested a review from a team as a code owner September 24, 2021 05:59
@seanbudd seanbudd self-assigned this Sep 27, 2021
source/NVDAObjects/IAccessible/__init__.py Outdated Show resolved Hide resolved
source/NVDAObjects/IAccessible/__init__.py Outdated Show resolved Hide resolved

def gridCoordStringToNumbers(coordString):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the removal of these functions and classes going to affect add-ons?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's very unlikely I think. Add-ons should avoid using appModules directly.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@feerrenrut @michaelDCurran what do you think?

Copy link
Member

@seanbudd seanbudd Oct 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@feerrenrut - requested you review pending this discussion, and my concerns including this in 2021.3

Co-authored-by: Sean Budd <seanbudd123@gmail.com>
@CyrilleB79
Copy link
Collaborator

@LeonarddeR you wrote:

That's very unlikely I think. Add-ons should avoid using appModules directly.

I think that this assumption is not correct.

In my Outlook Extended add-on, I import the native Outlook appModule to extend its capability.

The import statements are as follow:

# Import all from original outlook appModule to keep it available if needed.
from nvdaBuiltin.appModules.outlook import *
# Import here explecitely used variables from original outlook appModule for clarity.
from nvdaBuiltin.appModules.outlook import UIAGridRow, AddressBookEntry, AppModule

@LeonarddeR
Copy link
Collaborator Author

Indeed, the only reason why you would like to import an appModule directly is by extending it. With my statement, I meant that it is unlikely that an add-on would import a top level function from an appModule for another reason than extending the appModule. Having said that, I think that, while we should not break NVDA API compatibility other than in Addon API version changing releases, appModules shouldn't be treated as part of the NVDA API. NVDA makes this pretty clear by design, as many objects that are app specific yet reside in the core NVDAObjects package.

@seanbudd
Copy link
Member

If this PR doesn't preserve API compatibility it will have to wait until 2022.1

@LeonarddeR
Copy link
Collaborator Author

I guess that depends on whether the cleanup I did in the soffice appModule for stuff that hasn't been used for years is considered API breaking?

@seanbudd seanbudd added this to the 2022.1 milestone Oct 13, 2021
@seanbudd
Copy link
Member

This PR seems otherwise ready to go, other than API breaking concerns. Will aim to merge this in early once we branch for 2022.1

Copy link
Member

@seanbudd seanbudd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the wait @LeonarddeR

@seanbudd seanbudd merged commit 32bf54e into nvaccess:master Oct 20, 2021
michaelweghorn added a commit to michaelweghorn/nvda that referenced this pull request Jan 12, 2022
Link to issue number:
Fixes nvaccess#13232

Summary of the issue:
Since commit 32bf54e
("Improve selection and merged cell announcements in
LibreOffice Calc 7.3 and above (nvaccess#12849)"), information
about selected cells in LibreOffice Calc is
queried using the IAccessibleTable2 interface which is
supported from LibreOffice 7.3 on.
The call to the 'selectedCells' method on that interface
requests a list of currently selected accessibles.
Since Calc can have more than 1 billion cells, generating
the accessible objects for currently selected cells can
take a long time when many cells are selected.

Description of how this pull request fixes the issue:
Before calling the 'selectedCells' method, the number
of currently selectd cells is retrieved first and the
previous mechanism of announcing exact selected cells
is only used if at most 2000 cells are selected.
Otherwise, only the number of selected cells is announced.
For the special case where all cells are selected
(i.e. the number of selected cells is the same as the
number of the table's children), "all cells"
are reported as selected.
michaelweghorn added a commit to michaelweghorn/nvda that referenced this pull request Jan 12, 2022
Link to issue number:
Fixes nvaccess#13232

Summary of the issue:
Since commit 32bf54e
("Improve selection and merged cell announcements in
LibreOffice Calc 7.3 and above (nvaccess#12849)"), information
about selected cells in LibreOffice Calc is
queried using the IAccessibleTable2 interface which is
supported from LibreOffice 7.3 on.
The call to the 'selectedCells' method on that interface
requests a list of currently selected accessibles.
Since Calc can have more than 1 billion cells, generating
the accessible objects for currently selected cells can
take a long time when many cells are selected.

Description of how this pull request fixes the issue:
Before calling the 'selectedCells' method, the number
of currently selectd cells is retrieved first and the
previous mechanism of announcing exact selected cells
is only used if at most 2000 cells are selected.
Otherwise, only the number of selected cells is announced.
For the special case where all cells are selected
(i.e. the number of selected cells is the same as the
number of the table's children), "all cells"
are reported as selected.
michaelweghorn added a commit to michaelweghorn/nvda that referenced this pull request Jan 21, 2022
Link to issue number:
Fixes nvaccess#13232

Summary of the issue:
Since commit 32bf54e
("Improve selection and merged cell announcements in
LibreOffice Calc 7.3 and above (nvaccess#12849)"), information
about selected cells in LibreOffice Calc is
queried using the 'IAccessibleTable2' interface which is
supported from LibreOffice 7.3 on.
The call to the 'selectedCells' method on that interface
requests a list of a11y objects for all currently selected
cells, of which only the first and the last one are
actually needed for the announcement of selected cells.
Since Calc spreadsheets have more than a billion cells,
this is inefficient when many cells are selected
and resulted in Calc becoming unresponsive.

Description of how this pull request fixes the issue:
Instead of using the 'selectedCells' method from the
'IAccessibleTable2' interface, the first and last
selected cell are now retrieved using the
'accSelection' on the 'IAccessible' object of the table,
which avoids that a11y objects for all other selected
cells have to be generated as well.
seanbudd pushed a commit that referenced this pull request Jun 30, 2022
Fixes #13232

Summary of the issue:
Since PR #12849, information about selected cells in LibreOffice Calc is queried using the 'IAccessibleTable2' interface which is supported from LibreOffice 7.3 on.
The call to the 'selectedCells' method on that interface requests a list of a11y objects for all currently selected cells, of which only the first and the last one are actually needed for the announcement of selected cells.
Since Calc spreadsheets have more than a billion cells, this is inefficient when many cells are selected and resulted in Calc becoming unresponsive.

Description of how this pull request fixes the issue:
Instead of using the 'selectedCells' method from the 'IAccessibleTable2' interface, the first and last selected cell are now retrieved using the 'accSelection' on the 'IAccessible' object of the table, which avoids that a11y objects for all other selected cells have to be generated as well.

Testing strategy:
use LibreOffice Calc 7.3 or above
select all cells in LO Calc and check that NVDA announces coordinate + content of the first cell (A1) and the last cell (AMJ1048576) in the spreadsheet
test a few other selections in the spreadsheet (use shift + arrow keys to increase/decrease selection)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LibreOffice Calc: report merged cell coordinates LibreOffice Calc: report selected cell coordinates
6 participants